package com.hzdl.car.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzdl.car.bean.Announce;
import com.hzdl.car.bean.Customer;
import com.hzdl.car.mapper.CustomerMapper;
import com.hzdl.car.service.CustomerService;
import com.hzdl.car.vo.CustomerVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomerServiceImpl implements CustomerService {
    @Autowired
    private CustomerMapper cm;
    @Override
    public PageInfo findCustomerByWhere(CustomerVo customerVo) {
        PageHelper.startPage(customerVo.getPage(),customerVo.getLimit());
        List<Customer> cList = cm.findCustomerByWhere(customerVo);
        PageInfo pageInfo = new PageInfo(cList);
        return pageInfo;
    }

    @Override
    public int insertCustomer(CustomerVo customerVo) {
        return cm.insertCustomer(customerVo);
    }

    @Override
    public int updateCustomer(CustomerVo customerVo) {
        return cm.updateCustomer(customerVo);
    }

    @Override
    public int deleteCustomerByIdentity(String identity) {
        return cm.deleteCustomerByIdentity(identity);
    }

    @Override
    public List<Customer> exportCustomer(CustomerVo customerVo) {
        return cm.findCustomerByWhere(customerVo);
    }
}
